package cuid.sc20.laboratory.exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

@ControllerAdvice
public class GlobalExceptionHandler {
    //-- int[] array = {1,2,3,4,5}
    @ExceptionHandler(value = {JwtException.class , UserException.class})
    public String doGlobalException(Exception e, RedirectAttributes map){
        map.addAttribute("message",e.getMessage());
        return "redirect:/login/goToLogin";
    }
}
